package demo.android.com.mvpdemo.RxJava;

import android.support.annotation.NonNull;
import android.util.Log;

/**
 * Created by Vya on 2018/1/26 0026.
 * 正宗的静态代理
 */

public class LambdaObserver<T> implements Observer<T> {

    private Consumer<T> onNext;
    public LambdaObserver(Consumer<T> onNext){
        this.onNext = onNext;
    }
    @Override
    public void onNext(@NonNull T item) {
        onNext.onNext(item);
    }

    @Override
    public void onError(@NonNull Throwable e) {
        Log.e("wangyan",e.getMessage());
    }

    @Override
    public void onSubscribe() {

    }

    @Override
    public void onComplete() {

    }

}
